// 评委获取
import axiosReq from '@/utils/axios-req'
const BASE_URL = import.meta.env.VITE_APP_BASE_URL_SYH

/**
 * 评委信息-列表
 * @param data
 * {
  "projectId": 14,
  "pageNo": 1,
  "pageSize": 10
}
 * @returns
 */
export const judgesInfo = (data: any) => {
  const projectId = useProjectInfoStore().projectInfo.id
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/judgesInfo/list`,
    method: 'POST',
    data: {
      ...data,
      projectId
    }
  })
}

/**
 * 评委信息-新增/修改
 * @param data
 * @returns
 */
export const judgesInfoAdd = (data: any) => {
  const projectId = useProjectInfoStore().projectInfo.id
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/judgesInfo/saveUpdate`,
    method: 'POST',
    data: {
      ...data,
      projectId
    },
    showMsg: true
  })
}

/**
 * 评委信息-删除
 * @param data
 * {
  "id": 1
}
 * @returns
 */
export const judgesInfoDelete = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/judgesInfo/delete`,
    method: 'POST',
    data,
    showMsg: true
  })
}

// 评委信息-批量删除
export const judgesInfoBatchDelete = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/judgesInfo/batchDelete`,
    method: 'POST',
    data,
    showMsg: true
  })
}

/**
 * 评委信息-查看
 * @param data {
  "id": 1
}
 * @returns 
 */
export const judgesInfoView = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/judgesInfo/view`,
    method: 'POST',
    data
  })
}

/**
 * 项目评审项信息-列表-通过项目ID获取
 * @param data ?projectId=6
 * @returns
 */
export const projectItemInfoList = () => {
  const projectId = useProjectInfoStore().projectInfo.id
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/projectBandInfo/listByProjectId`,
    method: 'get',
    params: {
      projectId
    }
  })
}
